<?php

namespace app\common\model;

use think\Model;
use think\Db;

class Website extends Model {
	function getAll() {
		$data = db ( 'website' )->select ();
		foreach ( $data as $k => $v )
			$dt [$v ['key']] = $v ['val'];
		return $dt;
	}
	function delAll($map) {
		return db ( 'website' )->where ( $map )->delete ();
	}
	function getInfo($map) {
		return db ( 'website' )->where ( $map )->find ();
	}
	function add($data) {
		return db ( 'website' )->insertGetId ( $data );
	}
	function edit($map, $data) {
		return db ( 'website' )->where ( $map )->update ( $data );
	}
	function getAllNav($map) {
		return db ( 'nav' )->where ( $map )->order ( 'id desc' )->select ();
	}
	function addNav($data) {
		return db ( 'nav' )->insertGetId ( $data );
	}
	function editNav($map, $data) {
		return db ( 'nav' )->where ( $map )->update ( $data );
	}
	function getNavInfo($map) {
		return db ( 'nav' )->where ( $map )->find ();
	}
	function delNav($map) {
		return db ( 'nav' )->where ( $map )->delete ();
	}
	function getIpforbid($map, $row = 20) {
		$list = db ( 'ipforbid' )->where ( $map )->order ( 'id desc' )->paginate ( $row );
		$page = $list->render ();
		return array ('list' => $list,'page' => $page );
	}
	function ipforbidInfo($map) {
		return db ( 'ipforbid' )->where ( $map )->find ();
	}
	function addIpforbid($data) {
		return db ( 'ipforbid' )->insertGetId ( $data );
	}
	function delIpforbid($map) {
		return db ( 'ipforbid' )->where ( $map )->delete ();
	}
}

?>